package com.eshidai.simple_customer.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Service
public class ConsumerService {
	@Autowired
	private RestTemplate restTemplate;
	
	@HystrixCommand(fallbackMethod="addSreviceFallBack")
	public String addSrevice() {
		return restTemplate.getForEntity("http://simple-provider-service/add?a=10&b=20", String.class).getBody();
	}
	
	public String addSreviceFallBack() {
		return "error";
	}
}
